package com.damai.aop.impl;

import java.lang.reflect.Method;

import com.damai.aop.MethodCaller;
import com.damai.error.ErrorUtil;

public class DefaultMethodCaller implements MethodCaller {
	
	private Method method;
	
	public DefaultMethodCaller(Method method){
		this.method = method;
	}
	

	@Override
	public Object call(Object target, Object[] args) {
		try {
			return method.invoke(target, args);
		} catch (Exception e) {
			throw ErrorUtil.wrapThrow(e);
		}
	}

}
